﻿using System;

namespace Test.Entities
{
	public abstract class TimestampedEntity : IdentifiableEntity, ITimestampedEntity
	{
		#region Fields

		private DateTime _dateCreated;
		private DateTime _dateUpdated;

		#endregion

		#region Properties

		public DateTime DateCreated
		{
			get
			{
				if (_dateCreated == DateTime.MinValue)
				{
					_dateCreated = DateTime.Now;
				}

				return _dateCreated;
			}
			set
			{
				_dateCreated = value;
			}
		}

		public DateTime DateUpdated
		{
			get
			{
				if (_dateUpdated == DateTime.MinValue)
				{
					_dateUpdated = DateTime.Now;
				}

				return _dateUpdated;
			}
			set
			{
				_dateUpdated = value;
			}
		}

		#endregion
	}
}
